package com.yang.provider.controller;

import com.yang.provider.entity.Order;
import com.yang.provider.service.OrderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ：YangRan
 * @date ：Created in 2021/11/24 15:11
 * @description：订单接口
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Resource
    private OrderService orderServer;

    @PostMapping("/createOrder")
    public boolean createOrder(Order order) {
        return orderServer.createOrder(order.getUserId(), order.getProductId());
    }

    @PostMapping("/createOrderWithoutRedisLock")
    public boolean createOrderWithoutRedisLock(Order order) {
        return orderServer.createOrderWithoutRedisLock(order.getUserId(), order.getProductId());
    }
}


